rest_pre_insert_{$this->taxonomy}
Filter HookDescription
Filters term data before inserting term via the REST API. The dynamic portion of the hook name, `$this->taxonomy`, refers to the taxonomy slug. Possible hook names include: - `rest_pre_insert_category` - `rest_pre_insert_post_tag`Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 885 |
Hook Parameters
Type | Name | Description |
---|---|---|
object
|
$prepared_term
|
Term object. |
WP_REST_Request
|
$request
|
Request object. |
Usage Examples
Basic Usage
<?php
// Hook into rest_pre_insert_{$this->taxonomy}
add_filter('rest_pre_insert_{$this->taxonomy}', 'my_custom_filter', 10, 2);
function my_custom_filter($prepared_term, $request) {
// Your custom filtering logic here
return $prepared_term;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:885
- How this hook is used in WordPress core
<?php
880 * @since 4.7.0
881 *
882 * @param object $prepared_term Term object.
883 * @param WP_REST_Request $request Request object.
884 */
885 return apply_filters( "rest_pre_insert_{$this->taxonomy}", $prepared_term, $request );
886 }
887
888 /**
889 * Prepares a single term output for response.
890 *
PHP Documentation
<?php
/**
* Filters term data before inserting term via the REST API.
*
* The dynamic portion of the hook name, `$this->taxonomy`, refers to the taxonomy slug.
*
* Possible hook names include:
*
* - `rest_pre_insert_category`
* - `rest_pre_insert_post_tag`
*
* @since 4.7.0
*
* @param object $prepared_term Term object.
* @param WP_REST_Request $request Request object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
Related Hooks
Related hooks will be displayed here in future updates.